/*
 * 
 */
package com.example.diccionarioandroid;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;

// TODO: Auto-generated Javadoc
/**
 * The Class EspanolMapudungun.
 */
@SuppressLint("CutPasteId") public class EspanolMapudungun extends Activity implements OnItemSelectedListener{
	
	/* (non-Javadoc)
	 * @see android.app.Activity#onCreate(android.os.Bundle)
	 */
	@Override
    public void onCreate(Bundle savedInstanceState){
    	
    	super.onCreate(savedInstanceState);
    	setContentView(R.layout.espanol_mapudungun);
    	
    	Spinner sp = (Spinner)findViewById(R.id.spespanol);
    	ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, 
    			R.array.spespanol, android.R.layout.simple_spinner_item);
    	adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    	sp.setAdapter(adapter);
    	
    	sp.setOnItemSelectedListener(new OnItemSelectedListener() {

			@Override
			public void onItemSelected(AdapterView<?> parent, View view,
					int position, long id) {
				// TODO Auto-generated method stub
				Toast.makeText(parent.getContext(), "Ha Selecionado " + parent.getItemAtPosition(position).toString(), Toast.LENGTH_LONG).show();
			}

			@Override
			public void onNothingSelected(AdapterView<?> parent) {
				// TODO Auto-generated method stub
				
			}
		});
    }

	/* (non-Javadoc)
	 * @see android.widget.AdapterView.OnItemSelectedListener#onItemSelected(android.widget.AdapterView, android.view.View, int, long)
	 */
	@Override
	public void onItemSelected(AdapterView<?> parent, View view, int position,
			long id) {
		// TODO Auto-generated method stub
	}

	/* (non-Javadoc)
	 * @see android.widget.AdapterView.OnItemSelectedListener#onNothingSelected(android.widget.AdapterView)
	 */
	@Override
	public void onNothingSelected(AdapterView<?> parent) {
		// TODO Auto-generated method stub
	}
	
	/**
	 * Traducir.
	 */
	public void traducir(){
		final EditText txtPalabra = (EditText)findViewById(R.id.spespanol);
        final Button btnTraductor = (Button)findViewById(R.id.button1);
        
        btnTraductor.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent = new Intent(EspanolMapudungun.this, 
						EspanolMapudungun.class);
				
				Bundle b = new Bundle();
				//b.putString("palabramapudungun", );
				
			}
		});
	}

}
